package com.zhuangjie.shop.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhuangjie.mvc.validator.annotate.Contains;
import com.zhuangjie.mvc.validator.valid.DefaultGroup;
import com.zhuangjie.mvc.validator.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * 商店经营规则
 * <p>
 *
 * </p>
 *
 * @author zhuangjie
 * @date 2023/11/24
 * @since 2023-11-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("shop_business_rules")
@ApiModel(value="ShopBusinessRules对象", description="")
public class ShopBusinessRules implements Serializable {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "id编号")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(groups = {UpdateGroup.class},message = "更新id不能为空")
    private Long id;

    @ApiModelProperty(value = "店铺id")
    @TableField("shop_id")
    private Long shopId;

    @ApiModelProperty(value = "类型 1普通类型、2特殊类型")
    @TableField("type")
    @NotNull(groups = {DefaultGroup.class},message = "规则类型不能为空")
    private Integer type;

    @ApiModelProperty(value = "若是普通类型读此列（周）")
    @TableField("weeks")
    private String weeks;

    @ApiModelProperty(value = "若是特殊类型是读")
    @TableField("start_date")
    private LocalDate startDate;

    @ApiModelProperty(value = "若是特殊类型是读")
    @TableField("end_date")
    private LocalDate endDate;

    @ApiModelProperty(value = "若干的时间段(12:30-14:30,17:30-18:00,...)")
    @TableField("times")
    @Contains(groups = {DefaultGroup.class},value= ":")
    private String times;


}
